﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <script src="~/plugins/mzui/js/mzui.min.js"></script>
    <link href="~/plugins/mzui/css/mzui.min.css" rel="stylesheet" />
    <script src="~/js/pca.js" charset="gb2312"></script>
    <title>个人中心</title>
    <style>
        .profile-haeder {
            position: relative;
            overflow: hidden;
            min-height: 8rem
        }

            .profile-haeder > .back {
                top: -2rem;
                left: -2rem;
                right: -2rem;
                bottom: -2rem;
                background-position: center;
                background-size: cover
            }

            .profile-haeder > .front {
                background: rgba(0,0,0,.1);
                text-align: center;
                padding: 1.5rem
            }
    </style>
</head>
<body class="with-nav-bottom">
    <div class="profile-haeder space shadow">
        <div class="red dock blur-lg back" style="background-image: url(/images//logo.png)"></div>
        <div class="front dock text-white">
            <div class="avatar avatar-xl circle space-sm">
                <img id="pictureimg" src="@ViewBag.picture" onerror="this.src = '/images/nopic.png'" />
            </div>
            <div class="cell lead" style="margin-left:50px;">@ViewBag.account<div class="label @ViewBag.gc">@ViewBag.grade</div><div class="label success @(ViewBag.grade =="高级会员"?"hidden":"")" data-display data-backdrop="true" data-target="#lv">升级</div></div>
        </div>
    </div>

    <div class="section">
        <div class="list with-divider">
            <a data-display data-backdrop="true" data-target="#grzl" class="item with-avatar">
                <div class="avatar text-gray"><i class="icon-user"></i></div>
                <div class="title">个人资料</div>
                <i class="icon icon-arrow-up muted"></i>
            </a>
            <a data-display data-backdrop="true" data-target="#sfz" class="item with-avatar">
                <div class="avatar text-gray"><i class="icon icon-lock"></i></div>
                <div class="title">银行帐号/实名制 <div class="label success outline">@(ViewBag.qx == "正常" ? "√" : "审核中")</div></div>
                <i class="icon icon-arrow-up muted"></i>
            </a>
            <a href="/user/wddd" class="item with-avatar">
                <div class="avatar text-gray"><i class="icon icon-gift"></i></div>
                <div class="title">我的消费 <div class="label info outline rounded">@ViewBag.wdxf</div></div>
                <i class="icon icon-chevron-right muted"></i>
            </a>
            <a href="/user/wdzh" class="item with-avatar">
                <div class="avatar text-gray"><i class="icon-dollar"></i></div>
                <div class="title">我的提现 <div class="label special outline rounded">@ViewBag.wdzh</div></div>
                <i class="icon icon-chevron-right muted"></i>
            </a>
            <a href="/user/wdtj?number=@ViewBag.number" class="item with-avatar">
                <div class="avatar text-gray"><i class="icon-cog"></i></div>
                <div class="title">我的粉丝</div>
                <i class="icon icon-chevron-right muted"></i>
            </a>
            <a data-display data-backdrop="true" data-target="#wx" class="item with-avatar">
                <div class="avatar text-gray"><i class="icon icon-picture"></i></div>
                <div class="title">提现帐号(微信收款码)</div>
                <i class="icon icon-arrow-up muted"></i>
            </a>
            <a data-display data-backdrop="true" data-target="#lxwm" class="item with-avatar">
                <div class="avatar text-gray"><i class="icon-phone-sign"></i></div>
                <div class="title">联系我们</div>
                <i class="icon icon-arrow-up muted"></i>
            </a>
            <a href="/logout.aspx?lx=1" class="item with-avatar primary">
                <div class="title text-center">退出当前帐号</div>
            </a>
        </div>
    </div>
    <div id="sfz" class="affix dock-bottom modal hidden">
        <div class="heading">
            <div class="title"><strong>银行帐号/实名制</strong></div>
            <nav class="nav"><a data-dismiss="display"><i class="icon-remove muted"></i></a></nav>
        </div>
        <section class="section">
            <div class="box">
                <div class="control">
                    <label>身份证(人像面)</label>
                    <img class="blur-sm" id="idcardimg" src="@ViewBag.sfzpicture" onerror="this.src = '/images/nopic.png'" />
                    <p class="help-text"><input id="idcard" type="file" /></p>
                </div>
                <div class="control has-label-left has-icon-right has-error">
                    <input id="haoma" name="haoma" type="text" class="input" placeholder="请填写你的身份证号码" value="@ViewBag.sfz">
                    <label for="haoma"><i class="icon icon-keyboard"></i></label>
                    <p id="sfzmsg" class="help-text"></p>
                </div>
                <div class="control has-label-left has-icon-right has-error">
                    <input id="real_name" name="real_name" type="text" class="input" placeholder="请填写你当前微信认证银行卡的姓名" value="@ViewBag.real_name">
                    <label for="real_name"><i class="icon-user"></i></label>
                    <p id="zsxm" class="help-text"></p>
                </div>
                <div class="control has-label-left has-icon-right">
                    <div class="radio inline-block">
                        <input type="radio" id="nan" name="lr" value="1" onchange="setradio('1')">
                        <label for="lr">男</label>
                    </div>
                    <div class="radio inline-block">
                        <input type="radio" id="nv" name="lr" value="2" onchange="setradio('2')">
                        <label for="lr">女</label>
                    </div>
                    <input id="sex" name="sex" type="text" value="1" class="hidden">
                </div>
                <div class="control has-label-left has-icon-right has-error">
                    <input id="khh" name="khh" type="text" class="input" placeholder="开户行" value="@ViewBag.khh">
                    <label for="khh"><i class="icon-smile"></i></label>
                    <p id="zsxm" class="help-text"></p>
                </div>
                <div class="control has-label-left has-icon-right has-error">
                    <input id="khm" name="khm" type="text" class="input" placeholder="开户人" value="@ViewBag.khm">
                    <label for="khm"><i class="icon-user"></i></label>
                    <p id="zsxm" class="help-text"></p>
                </div>
                <div class="control has-label-left has-icon-right has-error">
                    <input id="kahao" name="kahao" type="text" class="input" placeholder="银行卡号" onkeyup="value=value.replace(/[^\d]/g,'');" value="@ViewBag.kahao">
                    <label for="kahao"><i class="icon-credit"></i></label>
                    <p id="sfzmsg" class="help-text"></p>
                </div>
                <div class="control">
                    <button type="button" id="idcardbt" class="btn block primary" onclick="return upsfz();">提交</button>
                </div>
            </div>
        </section>
    </div>
    <div id="grzl" class="affix dock-bottom modal hidden">
        <div class="heading">
            <div class="title"><strong>个人资料</strong></div>
            <nav class="nav"><a data-dismiss="display"><i class="icon-remove muted"></i></a></nav>
        </div>
        <section class="section">
            <div class="box">
                <div class="control has-error">
                    <select name="province" id="Province">
                        <option></option>
                    </select> -
                    <select name="city" id="City">
                        <option></option>
                    </select> -
                    <select name="area" id="Area">
                        <option></option>
                    </select>
                    <p id="china" class="help-text"></p>
                </div>
                <div class="control">
                    <label>个人头像</label>
                    <div class="avatar avatar-xl"><img id="uimg" src="@ViewBag.picture" onerror="this.src = '/images/nopic.png'" /></div>
                    <p class="help-text"><input id="picture" type="file" /></p>
                </div>
                <div class="control has-label-left has-icon-right">
                    <input id="nickname" name="nickname" type="text" class="input" placeholder="昵称" value="@ViewBag.nickname">
                    <label for="nickname"><i class="icon icon-github"></i></label>
                    <p class="help-text">请填写你的昵称。</p>
                </div>
                <div class="control">
                    <label for="pwd">当前密码</label>
                    <input id="pwd" name="pwd" type="password" class="input" placeholder="请输入当前使用的密码">
                    <p id="mm" class="help-text">密码不变,请为空。</p>
                </div>
                <div class="control">
                    <label for="newpwd">新密码</label>
                    <input id="newpwd" name="newpwd" type="password" class="input" placeholder="请输入新密码">
                    <p id="xmm" class="help-text">请使用不少于 6 个字符的密码。</p>
                </div>
                <div class="control">
                    <button type="button" id="picturebt" class="btn block primary" onclick="return grzl();">提交</button>
                </div>
            </div>
        </section>
    </div>
    <div id="wx" class="affix dock-bottom modal hidden">
        <div class="heading">
            <div class="title"><strong>收款码(在微信+号的收付款里有你的二维码)</strong></div>
            <nav class="nav"><a data-dismiss="display"><i class="icon-remove muted"></i></a></nav>
        </div>
        <section class="section">
            <div class="box">
                <div class="control">
                    <img id="ewmimg" src="@ViewBag.ewm" onerror="this.src = '/images/nopic.png'" />
                    <p class="help-text"><input id="ewm" type="file" /></p>
                </div>
                <div class="control">
                    <button id="ewmbt" type="button" class="btn block primary" onclick="return ewm();">提交数据</button>
                </div>
            </div>
        </section>
    </div>
    <!-- 联系我们 -->
    <div id="lxwm" class="affix dock-bottom modal hidden">
        <div class="heading">
            <div class="title"><strong>联系我们</strong></div>
            <nav class="nav"><a data-dismiss="display"><i class="icon-remove muted"></i></a></nav>
        </div>
        <div class="section">
            <div class="box">
                <p>
                    地址：福建省福州市鼓楼区新权南路12号金福商厦708单元<br />
                    电话：0591-83307879<br />
                    惠中信网络科技（福建）有限公司
                </p>
            </div>
        </div>
    </div>
    <!-- 会员升级 -->
    <div id="lv" class="affix dock-bottom modal hidden">
        <div class="heading">
            <div class="title"><strong>会员升级</strong></div>
            <nav class="nav"><a data-dismiss="display"><i class="icon-remove muted"></i></a></nav>
        </div>
        <div class="section">
            <div class="box">
                <div class="control @(ViewBag.grade =="初级会员"?"":"hidden")" data-dismiss="display" onclick="gopay('@ViewBag.cz');">
                    <div><div class="btn-lg info text-center">补 @ViewBag.czpay 升级中级会员</div></div>
                    <p class="help-text"></p>
                </div>
                <div class="control @(ViewBag.grade =="中级会员"?"":"hidden")" data-dismiss="display" onclick="gopay('@ViewBag.zg');">
                    <div><div class="btn-lg warning text-center">补 @ViewBag.zgpay 升级高级会员</div></div>
                    <p class="help-text"></p>
                </div>
                <div class="control @(ViewBag.grade =="初级会员"?"":"hidden")" data-dismiss="display" onclick="gopay('@ViewBag.cg');">
                    <div><div class="btn-lg warning text-center">补 @ViewBag.cgpay 升级高级会员</div></div>
                    <p class="help-text"></p>
                </div>
            </div>
        </div>
    </div>
    <nav class="nav affix dock-bottom justified">
        <a href="/home/index">商城</a>
        <a href="/user/grzx" class="active text-info">我的</a>
        <a href="/user/gopay">在线结账</a>
    </nav>
    <script src="~/js/jquery.js"></script>
    <script src="~/js/image.js"></script>
    <script>
        //设置省市区
        setup();
        if ("@ViewBag.province".length > 0) {
            preselect("@ViewBag.province");
            setTimeout("document.getElementById('City').value = '@ViewBag.city';change(2);", 1000);
            setTimeout("document.getElementById('Area').value = '@ViewBag.area';", 1000);
        }
        if (@ViewBag.sex == 1) {
            $("input[name='lr'][value='1']").attr("checked", true);
            document.getElementById("lx").value = "1";
        }
        else {
            $("input[name='lr'][value='2']").attr("checked", true);
            document.getElementById("lx").value = "2";
        }
        //设置性别
        function setradio(sex) {
            document.getElementById("sex").value = sex;
        }
        //身份证
        function upsfz() {
            if (document.getElementById("real_name").value.length < 2) {
                document.getElementById("zsxm").innerHTML = "真实姓名最少2个字";
                return false;
            }
            else
            {
                document.getElementById("zsxm").innerHTML = "";
            }
            if (document.getElementById("haoma").value.length != 18) {
                document.getElementById("sfzmsg").innerHTML = "请输入正确的身份证号码";
                return false;
            }
            else
            {
                document.getElementById("sfzmsg").innerHTML = "";
            }
            url = "/ajax/api.ashx?ff=sfz";
            id = "idcard";
            data = {
                real_name: $("#real_name").val(),
                haoma: $("#haoma").val(),
                khh: $("#khh").val(),
                khm: $("#khm").val(),
                kahao: $("#kahao").val(),
                sex: $("#sex").val()
            }
            loadImageFile(id);
        }

        //个人资料
        function grzl()
        {
            if (document.getElementById("Province").value == "请选择省份") {
                document.getElementById("china").innerHTML = "请选择省份";
                return false;
            }
            if (document.getElementById("City").value == "请选择城市") {
                document.getElementById("china").innerHTML = "请选择城市";
                return false;
            }
            if (document.getElementById("Area").value == "请选择区域") {
                document.getElementById("china").innerHTML = "请选择区域";
                return false;
            }
            else {
                document.getElementById("china").innerHTML = "";
            }
            if (document.getElementById("pwd").value.length != 0 && document.getElementById("pwd").value.length < 6) {
                document.getElementById("mm").innerHTML = "密码最少修6位";
                return false;
            }
            else {
                document.getElementById("mm").innerHTML = "";
            }
            if (document.getElementById("newpwd").value.length != 0 && document.getElementById("newpwd").value.length < 6) {
                document.getElementById("xmm").innerHTML = "密码最少修6位";
                return false;
            }
            else {
                document.getElementById("xmm").innerHTML = "";
            }
            url = "/ajax/api.ashx?ff=grzl";
            id = "picture";
            data = {
                Province: $("#Province").val(),
                City: $("#City").val(),
                Area: $("#Area").val(),
                nickname: $("#nickname").val(),
                pwd: $("#pwd").val(),
                newpwd: $("#newpwd").val()
            }
            loadImageFile(id);
        }
        //二维码上传
        function ewm()
        {
            url = "/ajax/api.ashx?ff=ewm";
            id = "ewm";
            loadImageFile(id);
        }
        //升级会员
        function gopay(gid)
        {
            $.ajax({
                    url: "/ajax/api.ashx",
                    data: "ff=gopay&lx=1&shopgid=" + gid + "&Cache=" + Math.random(),
                    type: "post",
                    cache: false,
                    timeout: 8000,
                    dataType: "json",
                    ContentType: "application/json; charset=utf-8",
                    async: false,//一定要是同步请求，否则会跳转；（ajax默认是异步的）
                    error: function () { alert("AJAX Error"); },
                    beforeSend: function () { },
                    success: function (data) {
                        if (data.appId != "payerr") {
                            WeixinJSBridge.invoke('getBrandWCPayRequest', data, function (res) {
                                switch (res.err_msg) {
                                    case "get_brand_wcpay_request:ok":
                                        self.location = "/home/msg?url=/home/denglu?lx=1&msg=升级成功,重新登录升级会员权益!";
                                        break;
                                    case "get_brand_wcpay_request:cancel":
                                        alert("你取消了支付,微信返回信息:" + res.err_msg);
                                        break;
                                    default:
                                        alert("支付失败,微信返回信息:" + res.err_msg);
                                        break;
                                }
                            });
                        }
                        else {
                            alert(data.return_msg);
                            if (data.return_msg == "登录异常")
                            {
                                self.location = "/home/denglu?lx=1";
                            }
                        }
                    },
                });
        }
    </script>
</body>
</html>
